<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>前后端交互</title>
		<script src="../js/vue.js"></script>
		<script type="text/javascript" src="../js/axios.js"></script>
	</head>
	<body>
		<script type="text/javascript">
			axios.defaults.baseURL = "http://localhost:8090"
			// let url1 = "http://localhost:8090/axios/saveUser"
			/* let user1 = {name:"张三",age:18,sex:"男"}
			axios.post("/axios/saveUser",user1)
				.then(function(promise){
					alert(promise.data)
				}) */
			/* async function saveUser(){
				let user2 = {name:"李四",age:18,sex:"男"}
				let promise = await axios.post("/axios/saveUser",user2)
				alert(promise.data)
			} */
			async function saveUser(){
				let user2 = {name:"李四",age:18,sex:"男"}
				let {data:data1} = await axios.post("/axios/saveUser",user2)
				alert(data1)
			}
			saveUser()
		</script>
	</body>
</html>
